import { Injectable } from '@nestjs/common';
import { CreateSysDeptDto } from './dto/create-sys-dept.dto';
import { UpdateSysDeptDto } from './dto/update-sys-dept.dto';
import { SysDept } from './entities/sys-dept.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';

@Injectable()
export class SysDeptService {
  constructor(
    @InjectRepository(SysDept)
    private readonly sysDeptRepository: Repository<SysDept>,
  ) {}

  async findById(deptId: any): Promise<any> {
    return await this.sysDeptRepository.findOne({
      where: {
        dept_id: deptId,
      },
    });
  }

  create(createSysDeptDto: CreateSysDeptDto) {
    return 'This action adds a new sysDept';
  }

  findAll() {
    return `This action returns all sysDept`;
  }

  findOne(id: number) {
    return `This action returns a #${id} sysDept`;
  }

  update(id: number, updateSysDeptDto: UpdateSysDeptDto) {
    return `This action updates a #${id} sysDept`;
  }

  remove(id: number) {
    return `This action removes a #${id} sysDept`;
  }
}
